package com.dingup.paike.feign.server.user;

import com.alibaba.fastjson.JSONObject;
import com.dingup.api.model.classInfo.ClassUserInfo;
import com.dingup.paike.service.pk.PkLessonUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ Created by wancheng on 2018/10/27.
 */
@RestController()
@RequestMapping("/feign/paike/user")
public class PaiKeUserFeign {

    private static Logger logger = LoggerFactory.getLogger(PaiKeUserFeign.class);

    @Autowired
    PkLessonUserService pkLessonUserService;
    /**
     * 删除学生 删除学生的相关课节信息
     *
     * @param studentId
     */
    @RequestMapping(value = "/delete_by_student_id.do", method = RequestMethod.POST)
    public void deleteStudent(@RequestBody ClassUserInfo classUserInfo) {
        logger.info("班级中删除,该班级下所有未完成课删除该人员,classUserInfo={}", JSONObject.toJSON(classUserInfo));
        pkLessonUserService.deletePkLessonStudent(classUserInfo);
    }

    @RequestMapping(value = "/add_by_student.do", method = RequestMethod.POST)
    public void addStudent(@RequestBody ClassUserInfo classUserInfo) {
        logger.info("班级中新增,该班级下所有未完成课节添加该人员,classUserInfo={}", JSONObject.toJSON(classUserInfo));
        pkLessonUserService.addPkLessonStudent(classUserInfo);
    }

}
